feat: add tenant entry registration APIs
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
//go:build mysql
|
||||
// +build mysql
|
||||
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEnsureTenantEntryControlTablesStatements(t *testing.T) {
|
||||
stmts := []string{
|
||||
`CREATE TABLE IF NOT EXISTS im_public_uploads(
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
file_id VARCHAR(64) NOT NULL,
|
||||
purpose VARCHAR(64) NOT NULL,
|
||||
PRIMARY KEY(id),
|
||||
UNIQUE INDEX uk_im_public_uploads_file(file_id)
|
||||
)`,
|
||||
`CREATE TABLE IF NOT EXISTS im_tenant_applications(
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
application_id VARCHAR(64) NOT NULL,
|
||||
credit_code VARCHAR(18) NOT NULL,
|
||||
idempotency_key VARCHAR(128) NOT NULL,
|
||||
UNIQUE INDEX uk_im_tenant_applications_idempotency(idempotency_key)
|
||||
)`,
|
||||
`CREATE TABLE IF NOT EXISTS im_tenant_entry_feedbacks(
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
feedback_id VARCHAR(64) NOT NULL,
|
||||
idempotency_key VARCHAR(128) NOT NULL,
|
||||
UNIQUE INDEX uk_im_tenant_entry_feedbacks_idempotency(idempotency_key)
|
||||
)`,
|
||||
}
|
||||
joined := strings.ToLower(strings.Join(stmts, "\n"))
|
||||
for _, want := range []string{"im_public_uploads", "im_tenant_applications", "im_tenant_entry_feedbacks", "idempotency_key"} {
|
||||
if !strings.Contains(joined, want) {
|
||||
t.Fatalf("schema statement missing %s", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user