generated from tsivinsky/go-template
allow to upload images
but also files, hmmmm
This commit is contained in:
27
db/migrations/20260316172048_init_images.sql
Normal file
27
db/migrations/20260316172048_init_images.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE images (
|
||||
id varchar primary key not null,
|
||||
data blob not null,
|
||||
user_id integer not null,
|
||||
created_at datetime default current_timestamp,
|
||||
updated_at datetime default current_timestamp,
|
||||
|
||||
FOREIGN KEY(user_id) REFERENCES users(id)
|
||||
);
|
||||
|
||||
CREATE TRIGGER update_images_updated_at
|
||||
AFTER UPDATE ON images
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE images
|
||||
SET updated_at = current_timestamp
|
||||
WHERE id = OLD.id;
|
||||
END;
|
||||
-- +goose StatementEnd
|
||||
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
DROP TABLE images;
|
||||
-- +goose StatementEnd
|
||||
|
||||
Reference in New Issue
Block a user