Generates the Ecto migration that creates Encryptor.Ecto.SuspensionStore's
table.
mix encryptor.ecto.gen.suspension_store_migration [--table NAME] [--migrations-path PATH]The table holds one row per suspended scope per vault: the vault's name, the selector, and when the suspension was written (ADR-0007 decision 1).
This task issues no DDL
It writes one file. Nothing here opens a database connection, and nothing in
this package issues CREATE TABLE at runtime or from a task (ADR-0002
decision 9). The generated file is yours the moment it lands: review it in a
diff, commit it, and run it with your own mix ecto.migrate.
The module name is generated from this project's application name and will need renaming if your repo lives in another namespace.
There is no --prefix, for the reason
mix encryptor.ecto.gen.key_store_migration gives: run the file with
mix ecto.migrate --prefix my_schema and pass the same name as prefix: in
the store's options.
Flags
| Flag | ||
|---|---|---|
--table NAME | encryptor_suspensions | The table to create. A host that renames it passes the same name as table: in the store's options |
--migrations-path PATH | priv/repo/migrations | Where to write the file |
Exit codes
0 | The file was written; its path is printed |
2 | Usage error, or a migration for this table already exists in that directory - the generator never overwrites one and never writes a second |
The shape it writes
One unique index over {vault, selector}. It is what makes a repeated
Encryptor.Vault.suspend/2 one row rather than two, and what keeps two
vaults' sets apart in one table.
selector is written :string, which is varchar(255) on Postgres: a
longer selector fails the suspension rather than being stored, as
Encryptor.Ecto.SuspensionStore says. A host whose selectors can be longer
widens the column in the generated file before running it.