Skip to content

Commit b30dbe2

Browse files
Adds SMF\Db\Schema\v1_0\* classes
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
1 parent d7a51a5 commit b30dbe2

36 files changed

Lines changed: 5930 additions & 0 deletions
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
3+
/**
4+
* Simple Machines Forum (SMF)
5+
*
6+
* @package SMF
7+
* @author Simple Machines https://www.simplemachines.org
8+
* @copyright 2023 Simple Machines and individual contributors
9+
* @license https://www.simplemachines.org/about/smf/license.php BSD
10+
*
11+
* @version 3.0 Alpha 3
12+
*/
13+
14+
declare(strict_types=1);
15+
16+
namespace SMF\Db\Schema\v1_0;
17+
18+
use SMF\Db\Schema\Column;
19+
use SMF\Db\Schema\DbIndex;
20+
use SMF\Db\Schema\Table;
21+
22+
/**
23+
* Defines all the properties for a database table.
24+
*/
25+
class Attachments extends Table
26+
{
27+
/****************
28+
* Public methods
29+
****************/
30+
31+
/**
32+
* Constructor.
33+
*/
34+
public function __construct()
35+
{
36+
$this->name = 'attachments';
37+
38+
$this->columns = [
39+
'ID_ATTACH' => new Column(
40+
name: 'ID_ATTACH',
41+
type: 'int',
42+
unsigned: true,
43+
not_null: true,
44+
auto: true,
45+
),
46+
'ID_MSG' => new Column(
47+
name: 'ID_MSG',
48+
type: 'int',
49+
unsigned: true,
50+
not_null: true,
51+
default: 0,
52+
),
53+
'ID_MEMBER' => new Column(
54+
name: 'ID_MEMBER',
55+
type: 'int',
56+
unsigned: true,
57+
not_null: true,
58+
default: 0,
59+
),
60+
'filename' => new Column(
61+
name: 'filename',
62+
type: 'tinytext',
63+
not_null: true,
64+
default: '',
65+
),
66+
'file_hash' => new Column(
67+
name: 'file_hash',
68+
type: 'varchar',
69+
size: 40,
70+
not_null: true,
71+
default: '',
72+
),
73+
'size' => new Column(
74+
name: 'size',
75+
type: 'int',
76+
unsigned: true,
77+
not_null: true,
78+
default: 0,
79+
),
80+
'downloads' => new Column(
81+
name: 'downloads',
82+
type: 'mediumint',
83+
unsigned: true,
84+
not_null: true,
85+
default: 0,
86+
),
87+
];
88+
89+
$this->indexes = [
90+
'primary' => new DbIndex(
91+
type: 'primary',
92+
columns: [
93+
[
94+
'name' => 'ID_ATTACH',
95+
],
96+
],
97+
),
98+
'ID_MEMBER' => new DbIndex(
99+
type: 'unique',
100+
name: 'ID_MEMBER',
101+
columns: [
102+
[
103+
'name' => 'ID_MEMBER',
104+
],
105+
[
106+
'name' => 'ID_ATTACH',
107+
],
108+
],
109+
),
110+
'ID_MSG' => new DbIndex(
111+
name: 'ID_MSG',
112+
columns: [
113+
[
114+
'name' => 'ID_MSG',
115+
],
116+
],
117+
),
118+
];
119+
120+
parent::__construct();
121+
}
122+
}

Sources/Db/Schema/v1_0/Banned.php

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<?php
2+
3+
/**
4+
* Simple Machines Forum (SMF)
5+
*
6+
* @package SMF
7+
* @author Simple Machines https://www.simplemachines.org
8+
* @copyright 2023 Simple Machines and individual contributors
9+
* @license https://www.simplemachines.org/about/smf/license.php BSD
10+
*
11+
* @version 3.0 Alpha 3
12+
*/
13+
14+
declare(strict_types=1);
15+
16+
namespace SMF\Db\Schema\v1_0;
17+
18+
use SMF\Db\Schema\Column;
19+
use SMF\Db\Schema\DbIndex;
20+
use SMF\Db\Schema\Table;
21+
22+
/**
23+
* Defines all the properties for a database table.
24+
*/
25+
class Banned extends Table
26+
{
27+
/****************
28+
* Public methods
29+
****************/
30+
31+
/**
32+
* Constructor.
33+
*/
34+
public function __construct()
35+
{
36+
$this->name = 'banned';
37+
38+
$this->columns = [
39+
'ID_BAN' => new Column(
40+
name: 'ID_BAN',
41+
type: 'mediumint',
42+
unsigned: true,
43+
not_null: true,
44+
auto: true,
45+
),
46+
'ban_type' => new Column(
47+
name: 'ban_type',
48+
type: 'varchar',
49+
size: 30,
50+
not_null: true,
51+
default: '',
52+
),
53+
'ip_low1' => new Column(
54+
name: 'ip_low1',
55+
type: 'tinyint',
56+
unsigned: true,
57+
not_null: true,
58+
default: 0,
59+
),
60+
'ip_high1' => new Column(
61+
name: 'ip_high1',
62+
type: 'tinyint',
63+
unsigned: true,
64+
not_null: true,
65+
default: 0,
66+
),
67+
'ip_low2' => new Column(
68+
name: 'ip_low2',
69+
type: 'tinyint',
70+
unsigned: true,
71+
not_null: true,
72+
default: 0,
73+
),
74+
'ip_high2' => new Column(
75+
name: 'ip_high2',
76+
type: 'tinyint',
77+
unsigned: true,
78+
not_null: true,
79+
default: 0,
80+
),
81+
'ip_low3' => new Column(
82+
name: 'ip_low3',
83+
type: 'tinyint',
84+
unsigned: true,
85+
not_null: true,
86+
default: 0,
87+
),
88+
'ip_high3' => new Column(
89+
name: 'ip_high3',
90+
type: 'tinyint',
91+
unsigned: true,
92+
not_null: true,
93+
default: 0,
94+
),
95+
'ip_low4' => new Column(
96+
name: 'ip_low4',
97+
type: 'tinyint',
98+
unsigned: true,
99+
not_null: true,
100+
default: 0,
101+
),
102+
'ip_high4' => new Column(
103+
name: 'ip_high4',
104+
type: 'tinyint',
105+
unsigned: true,
106+
not_null: true,
107+
default: 0,
108+
),
109+
'hostname' => new Column(
110+
name: 'hostname',
111+
type: 'tinytext',
112+
not_null: true,
113+
default: '',
114+
),
115+
'email_address' => new Column(
116+
name: 'email_address',
117+
type: 'tinytext',
118+
not_null: true,
119+
default: '',
120+
),
121+
'ID_MEMBER' => new Column(
122+
name: 'ID_MEMBER',
123+
type: 'mediumint',
124+
unsigned: true,
125+
not_null: true,
126+
default: 0,
127+
),
128+
'ban_time' => new Column(
129+
name: 'ban_time',
130+
type: 'int',
131+
unsigned: true,
132+
not_null: true,
133+
default: 0,
134+
),
135+
'expire_time' => new Column(
136+
name: 'expire_time',
137+
type: 'int',
138+
unsigned: true,
139+
),
140+
'restriction_type' => new Column(
141+
name: 'restriction_type',
142+
type: 'varchar',
143+
size: 30,
144+
not_null: true,
145+
default: '',
146+
),
147+
'reason' => new Column(
148+
name: 'reason',
149+
type: 'tinytext',
150+
not_null: true,
151+
default: '',
152+
),
153+
'notes' => new Column(
154+
name: 'notes',
155+
type: 'text',
156+
not_null: true,
157+
default: '',
158+
),
159+
];
160+
161+
$this->indexes = [
162+
'primary' => new DbIndex(
163+
type: 'primary',
164+
columns: [
165+
[
166+
'name' => 'ID_BAN',
167+
],
168+
],
169+
),
170+
];
171+
172+
parent::__construct();
173+
}
174+
}

0 commit comments

Comments
 (0)