package migrations import ( "github.com/pocketbase/pocketbase/core" m "github.com/pocketbase/pocketbase/migrations" ) func init() { m.Register(func(app core.App) error { jsonData := `[ { "createRule": null, "deleteRule": null, "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "9atm8h79", "max": 0, "min": 0, "name": "name", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" }, { "cascadeDelete": false, "collectionId": "_pb_users_auth_", "hidden": false, "id": "gga9fqhe", "maxSelect": 2147483647, "minSelect": 0, "name": "members", "presentable": false, "required": false, "system": false, "type": "relation" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": false, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": false, "type": "autodate" } ], "id": "l6lqbzxyn649nhg", "indexes": [ "CREATE UNIQUE INDEX ` + "`" + `idx_a1tmCfg` + "`" + ` ON ` + "`" + `organisations` + "`" + ` (` + "`" + `name` + "`" + `)" ], "listRule": "@request.auth.id != \"\" && members.id ?= @request.auth.id", "name": "organisations", "system": false, "type": "base", "updateRule": null, "viewRule": "@request.auth.id != \"\" && members.id ?= @request.auth.id" }, { "createRule": "@request.auth.id != \"\" && user.id ?= @request.auth.id", "deleteRule": "@request.auth.id != \"\" && user.id ?= @request.auth.id", "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "cascadeDelete": true, "collectionId": "adklaxw6khc2g8l", "hidden": false, "id": "pl8atfjg", "maxSelect": 1, "minSelect": 0, "name": "project", "presentable": false, "required": true, "system": false, "type": "relation" }, { "hidden": false, "id": "3spm6k8s", "max": "", "min": "", "name": "start", "presentable": false, "required": true, "system": false, "type": "date" }, { "hidden": false, "id": "a14hucc5", "max": "", "min": "", "name": "end", "presentable": false, "required": false, "system": false, "type": "date" }, { "autogeneratePattern": "", "hidden": false, "id": "bfe7t7yl", "max": 0, "min": 0, "name": "description", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" }, { "cascadeDelete": false, "collectionId": "_pb_users_auth_", "hidden": false, "id": "iwsn4wfk", "maxSelect": 1, "minSelect": 0, "name": "user", "presentable": false, "required": false, "system": false, "type": "relation" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": false, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": false, "type": "autodate" } ], "id": "q9qzdnsjjr1nunt", "indexes": [], "listRule": "@request.auth.id != \"\" && user.id ?= @request.auth.id", "name": "entries", "system": false, "type": "base", "updateRule": "@request.auth.id != \"\" && user.id ?= @request.auth.id", "viewRule": "@request.auth.id != \"\" && user.id ?= @request.auth.id" }, { "createRule": null, "deleteRule": null, "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "cascadeDelete": true, "collectionId": "l6lqbzxyn649nhg", "hidden": false, "id": "ivql3fwp", "maxSelect": 1, "minSelect": 0, "name": "organisation", "presentable": false, "required": true, "system": false, "type": "relation" }, { "autogeneratePattern": "", "hidden": false, "id": "oazzl2ia", "max": 0, "min": 0, "name": "name", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "gbspap7b", "max": 0, "min": 0, "name": "identifier", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": false, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": false, "type": "autodate" } ], "id": "adklaxw6khc2g8l", "indexes": [ "CREATE UNIQUE INDEX ` + "`" + `idx_IAGT9Ow` + "`" + ` ON ` + "`" + `projects` + "`" + ` (` + "`" + `name` + "`" + `)" ], "listRule": "@request.auth.id != \"\" && organisation.members.id ?= @request.auth.id", "name": "projects", "system": false, "type": "base", "updateRule": null, "viewRule": "@request.auth.id != \"\" && organisation.members.id ?= @request.auth.id" }, { "authAlert": { "emailTemplate": { "body": "

Hello,

\n

We noticed a login to your {APP_NAME} account from a new location.

\n

If this was you, you may disregard this email.

\n

If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "Login from a new location" }, "enabled": true }, "authRule": "", "authToken": { "duration": 1209600 }, "confirmEmailChangeTemplate": { "body": "

Hello,

\n

Click on the button below to confirm your new email address.

\n

\n Confirm new email\n

\n

If you didn't ask to change your email address, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "Confirm your {APP_NAME} new email address" }, "createRule": "", "deleteRule": "id = @request.auth.id", "emailChangeToken": { "duration": 1800 }, "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "cost": 10, "hidden": true, "id": "password901924565", "max": 0, "min": 8, "name": "password", "pattern": "", "presentable": false, "required": true, "system": true, "type": "password" }, { "autogeneratePattern": "[a-zA-Z0-9_]{50}", "hidden": true, "id": "text2504183744", "max": 60, "min": 30, "name": "tokenKey", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "exceptDomains": null, "hidden": false, "id": "email3885137012", "name": "email", "onlyDomains": null, "presentable": false, "required": false, "system": true, "type": "email" }, { "hidden": false, "id": "bool1547992806", "name": "emailVisibility", "presentable": false, "required": false, "system": true, "type": "bool" }, { "hidden": false, "id": "bool256245529", "name": "verified", "presentable": false, "required": false, "system": true, "type": "bool" }, { "autogeneratePattern": "users[0-9]{6}", "hidden": false, "id": "text4166911607", "max": 150, "min": 3, "name": "username", "pattern": "^[\\w][\\w\\.\\-]*$", "presentable": false, "primaryKey": false, "required": true, "system": false, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "users_name", "max": 0, "min": 0, "name": "name", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": false, "type": "text" }, { "hidden": false, "id": "users_avatar", "maxSelect": 1, "maxSize": 5242880, "mimeTypes": [ "image/jpeg", "image/png", "image/svg+xml", "image/gif", "image/webp" ], "name": "avatar", "presentable": false, "protected": false, "required": false, "system": false, "thumbs": null, "type": "file" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": false, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": false, "type": "autodate" } ], "fileToken": { "duration": 120 }, "id": "_pb_users_auth_", "indexes": [ "CREATE UNIQUE INDEX ` + "`" + `__pb_users_auth__username_idx` + "`" + ` ON ` + "`" + `users` + "`" + ` (username COLLATE NOCASE)", "CREATE UNIQUE INDEX ` + "`" + `__pb_users_auth__email_idx` + "`" + ` ON ` + "`" + `users` + "`" + ` (` + "`" + `email` + "`" + `) WHERE ` + "`" + `email` + "`" + ` != ''", "CREATE UNIQUE INDEX ` + "`" + `__pb_users_auth__tokenKey_idx` + "`" + ` ON ` + "`" + `users` + "`" + ` (` + "`" + `tokenKey` + "`" + `)" ], "listRule": "id = @request.auth.id", "manageRule": null, "mfa": { "duration": 1800, "enabled": false, "rule": "" }, "name": "users", "oauth2": { "enabled": false, "mappedFields": { "avatarURL": "", "id": "", "name": "", "username": "username" } }, "otp": { "duration": 180, "emailTemplate": { "body": "

Hello,

\n

Your one-time password is: {OTP}

\n

If you didn't ask for the one-time password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "OTP for {APP_NAME}" }, "enabled": false, "length": 8 }, "passwordAuth": { "enabled": true, "identityFields": [ "email", "username" ] }, "passwordResetToken": { "duration": 1800 }, "resetPasswordTemplate": { "body": "

Hello,

\n

Click on the button below to reset your password.

\n

\n Reset password\n

\n

If you didn't ask to reset your password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "Reset your {APP_NAME} password" }, "system": false, "type": "auth", "updateRule": "id = @request.auth.id", "verificationTemplate": { "body": "

Hello,

\n

Thank you for joining us at {APP_NAME}.

\n

Click on the button below to verify your email address.

\n

\n Verify\n

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "Verify your {APP_NAME} email" }, "verificationToken": { "duration": 604800 }, "viewRule": "id = @request.auth.id" }, { "authAlert": { "emailTemplate": { "body": "

Hello,

\n

We noticed a login to your {APP_NAME} account from a new location.

\n

If this was you, you may disregard this email.

\n

If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "Login from a new location" }, "enabled": true }, "authRule": "", "authToken": { "duration": 1209600 }, "confirmEmailChangeTemplate": { "body": "

Hello,

\n

Click on the button below to confirm your new email address.

\n

\n Confirm new email\n

\n

If you didn't ask to change your email address, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "Confirm your {APP_NAME} new email address" }, "createRule": null, "deleteRule": null, "emailChangeToken": { "duration": 1800 }, "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "cost": 0, "hidden": true, "id": "password901924565", "max": 0, "min": 8, "name": "password", "pattern": "", "presentable": false, "required": true, "system": true, "type": "password" }, { "autogeneratePattern": "[a-zA-Z0-9]{50}", "hidden": true, "id": "text2504183744", "max": 60, "min": 30, "name": "tokenKey", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "exceptDomains": null, "hidden": false, "id": "email3885137012", "name": "email", "onlyDomains": null, "presentable": false, "required": true, "system": true, "type": "email" }, { "hidden": false, "id": "bool1547992806", "name": "emailVisibility", "presentable": false, "required": false, "system": true, "type": "bool" }, { "hidden": false, "id": "bool256245529", "name": "verified", "presentable": false, "required": false, "system": true, "type": "bool" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": true, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": true, "type": "autodate" } ], "fileToken": { "duration": 120 }, "id": "pbc_3142635823", "indexes": [ "CREATE UNIQUE INDEX ` + "`" + `idx_tokenKey_pbc_3142635823` + "`" + ` ON ` + "`" + `_superusers` + "`" + ` (` + "`" + `tokenKey` + "`" + `)", "CREATE UNIQUE INDEX ` + "`" + `idx_email_pbc_3142635823` + "`" + ` ON ` + "`" + `_superusers` + "`" + ` (` + "`" + `email` + "`" + `) WHERE ` + "`" + `email` + "`" + ` != ''" ], "listRule": null, "manageRule": null, "mfa": { "duration": 1800, "enabled": false, "rule": "" }, "name": "_superusers", "oauth2": { "enabled": false, "mappedFields": { "avatarURL": "", "id": "", "name": "", "username": "" } }, "otp": { "duration": 180, "emailTemplate": { "body": "

Hello,

\n

Your one-time password is: {OTP}

\n

If you didn't ask for the one-time password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "OTP for {APP_NAME}" }, "enabled": false, "length": 8 }, "passwordAuth": { "enabled": true, "identityFields": [ "email" ] }, "passwordResetToken": { "duration": 1800 }, "resetPasswordTemplate": { "body": "

Hello,

\n

Click on the button below to reset your password.

\n

\n Reset password\n

\n

If you didn't ask to reset your password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "Reset your {APP_NAME} password" }, "system": true, "type": "auth", "updateRule": null, "verificationTemplate": { "body": "

Hello,

\n

Thank you for joining us at {APP_NAME}.

\n

Click on the button below to verify your email address.

\n

\n Verify\n

\n

\n Thanks,
\n {APP_NAME} team\n

", "subject": "Verify your {APP_NAME} email" }, "verificationToken": { "duration": 259200 }, "viewRule": null }, { "createRule": null, "deleteRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text455797646", "max": 0, "min": 0, "name": "collectionRef", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text127846527", "max": 0, "min": 0, "name": "recordRef", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text2462348188", "max": 0, "min": 0, "name": "provider", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text1044722854", "max": 0, "min": 0, "name": "providerId", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": true, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": true, "type": "autodate" } ], "id": "pbc_2281828961", "indexes": [ "CREATE UNIQUE INDEX ` + "`" + `idx_externalAuths_record_provider` + "`" + ` ON ` + "`" + `_externalAuths` + "`" + ` (collectionRef, recordRef, provider)", "CREATE UNIQUE INDEX ` + "`" + `idx_externalAuths_collection_provider` + "`" + ` ON ` + "`" + `_externalAuths` + "`" + ` (collectionRef, provider, providerId)" ], "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", "name": "_externalAuths", "system": true, "type": "base", "updateRule": null, "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" }, { "createRule": null, "deleteRule": null, "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text455797646", "max": 0, "min": 0, "name": "collectionRef", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text127846527", "max": 0, "min": 0, "name": "recordRef", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text1582905952", "max": 0, "min": 0, "name": "method", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": true, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": true, "type": "autodate" } ], "id": "pbc_2279338944", "indexes": [ "CREATE INDEX ` + "`" + `idx_mfas_collectionRef_recordRef` + "`" + ` ON ` + "`" + `_mfas` + "`" + ` (collectionRef,recordRef)" ], "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", "name": "_mfas", "system": true, "type": "base", "updateRule": null, "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" }, { "createRule": null, "deleteRule": null, "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text455797646", "max": 0, "min": 0, "name": "collectionRef", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text127846527", "max": 0, "min": 0, "name": "recordRef", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "cost": 8, "hidden": true, "id": "password901924565", "max": 0, "min": 0, "name": "password", "pattern": "", "presentable": false, "required": true, "system": true, "type": "password" }, { "autogeneratePattern": "", "hidden": true, "id": "text3866985172", "max": 0, "min": 0, "name": "sentTo", "pattern": "", "presentable": false, "primaryKey": false, "required": false, "system": true, "type": "text" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": true, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": true, "type": "autodate" } ], "id": "pbc_1638494021", "indexes": [ "CREATE INDEX ` + "`" + `idx_otps_collectionRef_recordRef` + "`" + ` ON ` + "`" + `_otps` + "`" + ` (collectionRef, recordRef)" ], "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", "name": "_otps", "system": true, "type": "base", "updateRule": null, "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" }, { "createRule": null, "deleteRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", "fields": [ { "autogeneratePattern": "[a-z0-9]{15}", "hidden": false, "id": "text3208210256", "max": 15, "min": 15, "name": "id", "pattern": "^[a-z0-9]+$", "presentable": false, "primaryKey": true, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text455797646", "max": 0, "min": 0, "name": "collectionRef", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text127846527", "max": 0, "min": 0, "name": "recordRef", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "autogeneratePattern": "", "hidden": false, "id": "text4228609354", "max": 0, "min": 0, "name": "fingerprint", "pattern": "", "presentable": false, "primaryKey": false, "required": true, "system": true, "type": "text" }, { "hidden": false, "id": "autodate2990389176", "name": "created", "onCreate": true, "onUpdate": false, "presentable": false, "system": true, "type": "autodate" }, { "hidden": false, "id": "autodate3332085495", "name": "updated", "onCreate": true, "onUpdate": true, "presentable": false, "system": true, "type": "autodate" } ], "id": "pbc_4275539003", "indexes": [ "CREATE UNIQUE INDEX ` + "`" + `idx_authOrigins_unique_pairs` + "`" + ` ON ` + "`" + `_authOrigins` + "`" + ` (collectionRef, recordRef, fingerprint)" ], "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", "name": "_authOrigins", "system": true, "type": "base", "updateRule": null, "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" } ]` return app.ImportCollectionsByMarshaledJSON([]byte(jsonData), false) }, func(app core.App) error { return nil }) }