Skip to content

Using Customization handler to insert app-generated ID #1021

Open
@apps-caraga

Description

@apps-caraga

I was just trying to use Universally Unique Lexicographically Sortable Identifier ULID with this library and was able to insert the ULID via the multitenancy middleware as follows:

	'multiTenancy.handler' => function ($operation, $tableName) {
			if($operation =='create' && $tableName=='data'){ 
				return['id'=>Ulid::generate()];
			}
		},

With SQLite, the post request is ok (data is saved and response status is HTTP 200) but returns {} or an empty array. Any idea why?

SQLite table schema:

CREATE TABLE data (
    id        TEXT (26) PRIMARY KEY
                        NOT NULL,
    content      TEXT,
    createdAt DATETIME  NOT NULL
                        DEFAULT (strftime('%Y-%m-%d %H:%M:%fZ') ) 
);

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions