feat(pg-migration): init
This commit is contained in:
12
package/postgres/pg-migration/src/lib.rs
Normal file
12
package/postgres/pg-migration/src/lib.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use postgres::Client;
|
||||
|
||||
pub fn init_db(client: &mut Client) {
|
||||
client.batch_execute("
|
||||
CREATE SCHEMA IF NOT EXISTS hectic;
|
||||
CREATE TABLE IF NOT EXISTS hectic.migration (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT UNIQUE NOT NULL,
|
||||
applied_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
").unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user