Hi! :wave: Are the mysqldelight `CREATE TABLE` po...
# squarelibraries
j
Hi! 👋 Are the mysqldelight
CREATE TABLE
postgresql statements expected to create tables automatically? I'm running a backend app and getting errors like:
Copy code
subscriptionsdb | 2021-07-14 12:30:42.092 UTC [56] ERROR:  relation "userentity" does not exist at character 15
subscriptionsdb | 2021-07-14 12:30:42.092 UTC [56] STATEMENT:  SELECT *
subscriptionsdb |       FROM userEntity
subscriptionsdb |       WHERE slack_user_id = $1
as if it wouldn't be able to find the
userEntity
table.
Copy code
CREATE TABLE IF NOT EXISTS userEntity (
    user_id SERIAL PRIMARY KEY,
    slack_user_id VARCHAR NOT NULL,
    slack_channel_id VARCHAR
);

insert:
INSERT INTO userEntity(slack_user_id, slack_channel_id)
VALUES (?, ?);

selectAll:
SELECT *
FROM userEntity;

select:
SELECT *
FROM userEntity
WHERE slack_user_id = ? AND slack_channel_id = ?;

selectByUserId:
SELECT *
FROM userEntity
WHERE user_id = ?;

selectBySlackUserId:
SELECT *
FROM userEntity
WHERE slack_user_id = ?;

selectBySlackChannelId:
SELECT *
FROM userEntity
WHERE slack_channel_id = ?;

delete:
DELETE FROM userEntity
WHERE user_id = ?
RETURNING *;