forked from samuelsolis/imf-ejemplos-temario
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Schema.php
41 lines (35 loc) · 1.05 KB
/
Schema.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
class Schema {
public function getSchema() {
$tables = array();
$tables['usuarios'] = array(
'email' => 'varchar(255) NOT NULL UNIQUE',
'nombre' => 'varchar(255) NOT NULL',
'apellidos' => 'varchar(255)',
'telefono' => 'char(9)',
'primary key' => '(email)',
);
$tables['colores'] = array(
'nombre' => 'varchar(255) NOT NULL UNIQUE',
'valor_hex' => 'char(7) NOT NULL UNIQUE',
'precio' => 'float',
'primary key' => '(valor_hex)',
);
$tables['coches'] = array(
'id' => 'int NOT NULL UNIQUE AUTO_INCREMENT',
'marca' => 'varchar(255) NOT NULL UNIQUE',
'modelo' => 'varchar(255) NOT NULL',
'matricula' => 'varchar(255) NOT NULL',
'color' => 'char(7)',
'propietario' => 'varchar(255) NOT NULL',
'primary key' => '(id)',
);
$tables['conductores'] = array(
'id' => 'int NOT NULL UNIQUE AUTO_INCREMENT',
'email' => 'varchar(255) NOT NULL',
'coche' => 'int NOT NULL',
'primary key' => '(id)',
);
return $tables;
}
}