- 2.0.11Latest
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0.0-rc5
- 2.0.0-rc4
- 2.0.0-rc3
- 2.0.0-rc2
- 2.0.0-rc1
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.3
- 1.1.2
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.4
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0.0-rc3
- v1.0.0-rc2
- v1.0.0-rc1
- v0.6.0
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.0
- v0.1.0
- v0.0.3
- v.0.0.3
- v0.0.2
- v0.0.1
- 0.4.0
Nessie
A database migration tool for deno inspired by Laravel. Supports PostgreSQL and MySQL, soon: SQLite. See documentation.
Supported databases
- PostgreSQL
- MySQL - Currently it works with password for 5.*, but for >=8 you have to send a blank password, see Deno MySQL for version support
- SQLite
If you have a database system you would like to see in this list, feel free to make an issue or create a pr with your implementation.
Usage
make [name]
: Create migrationdeno run --allow-net --allow-read --allow-write https://deno.land/x/nessie/cli.ts make create_users
migrate
: Run migration - will migrate all migrations in your migration folder (sorted by timestamp) newer than the latest migration in your dbdeno run --allow-net --allow-read https://deno.land/x/nessie/cli.ts migrate
deno run --allow-net --allow-read https://deno.land/x/nessie/cli.ts migrate -c ./nessie.config.ts
rollback
: Rollback - will rollback the latest migrationdeno run --allow-net --allow-read https://deno.land/x/nessie/cli.ts rollback
Flags
-c, --config
: Path to config file, will default to ./nessie.config.ts-d, --debug
: Enables verbose output
Contributing
Feel free to make pr’s or create an issue!
Uses
Examples
nessie.config.ts
import { nessieConfigType } from "https://deno.land/x/nessie/mod.ts";
const config: nessieConfigType = {
migrationFolder: "./migrations",
connection: { // These are the connection option from their respective db clients, will differ
host: "localhost",
port: 5432,
user: "root",
password: "pwd",
name: "nessie",
},
dialect: "pg",
};
export default config;
Minimal example of a migration file
import { Schema } from "https://deno.land/x/nessie/mod.ts";
export const up = (schema: Schema): void => {
schema.create("users", (table) => {
table.id();
table.string("name", 100).nullable();
table.boolean("is_true").default("false");
table.custom("custom_column int default 1");
table.timestamps();
});
schema.queryString(
"INSERT INTO users VALUES (DEFAULT, 'Deno', true, 2, DEFAULT, DEFAULT);",
);
};
export const down = (schema: Schema): void => {
schema.drop("users");
};
See example folder for more