2022-04-05 22:34:06 +03:00
|
|
|
import { query } from ".";
|
|
|
|
|
|
|
|
export default async function databaseInit() {
|
|
|
|
console.log(await query(`
|
2022-04-06 18:50:36 +03:00
|
|
|
CREATE TABLE IF NOT EXISTS users(
|
2022-04-05 22:34:06 +03:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
username VARCHAR(32) UNIQUE NOT NULL,
|
|
|
|
password TEXT
|
|
|
|
);
|
2022-04-06 18:50:36 +03:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS channels(
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name VARCHAR(32) UNIQUE NOT NULL,
|
|
|
|
owner_id SERIAL REFERENCES users
|
|
|
|
);
|
2022-04-05 22:34:06 +03:00
|
|
|
`));
|
|
|
|
}
|