big kahuna

This commit is contained in:
2026-08-15 23:05:57 -06:00
parent 6fec70c7c8
commit 84893662ca
25 changed files with 3886 additions and 27 deletions

21
lib/CW/Migration/01.pm Normal file
View File

@@ -0,0 +1,21 @@
package CW::Migration::01;
use Moo;
use FindBin;
extends 'CW::Migration';
sub id {
return 1;
}
sub sql {
return <<'SQL';
CREATE TABLE sessions (
id CHAR(72) PRIMARY KEY,
session_data TEXT
)
SQL
}
1;

21
lib/CW/Migration/02.pm Normal file
View File

@@ -0,0 +1,21 @@
package CW::Migration::02;
use Moo;
extends 'CW::Migration';
sub id {
return 2;
}
sub sql {
return <<'SQL';
CREATE TABLE boards (
id VARCHAR(3) PRIMARY KEY,
name VARCHAR(100),
description TEXT
)
SQL
}
1;

60
lib/CW/Migration/03.pm Normal file
View File

@@ -0,0 +1,60 @@
package CW::Migration::03;
use Moo;
extends 'CW::Migration';
sub id {
return 3;
}
sub sql {
my $boards = [
{
id => 't',
name => 'Technology',
description => 'Programming, computing, hardware discussion'
},
{
id => 'b',
name => 'Money',
description => 'Finance, money, and business discussion'
},
{
id => 'a',
name => 'Art',
description => 'Human made art (all forms welcome) discussion'
},
{
id => 's',
name => 'Math & Science',
description => 'Math and science discussion'
},
{
id => 'g',
name => 'Games',
description => 'Video, Tabletop, TCG, gaming discussion'
},
{
id => 'm',
name => 'Meta',
description => 'Discussion about compiled.world'
}
];
my $values = join(
",",
map {
"('"
. $_->{id} . "', '"
. $_->{name} . "', '"
. $_->{description} . "')"
} @$boards
);
my $sql =
'INSERT INTO boards (id, name, description) VALUES ' . $values . ';';
return $sql;
}
1;

25
lib/CW/Migration/04.pm Normal file
View File

@@ -0,0 +1,25 @@
package CW::Migration::04;
use Moo;
extends 'CW::Migration';
sub id {
return 4;
}
sub sql {
return q[CREATE TABLE users (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(24),
password VARCHAR(62),
admin BOOLEAN DEFAULT false,
active BOOLEAN DEFAULT false,
denied BOOLEAN DEFAULT false,
denied_reason TEXT,
join_request JSON NOT NULL
)
]
}
1;