-
Notifications
You must be signed in to change notification settings - Fork 25
/
2014_10_12_000000_create_posts_table.hpp
43 lines (34 loc) · 1.16 KB
/
2014_10_12_000000_create_posts_table.hpp
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
42
43
#pragma once
#include <tom/migration.hpp>
/* This class serves as a showcase, so all possible features are defined / used.
Only PostgreSQL and Microsoft SQL Server support the 'withinTransaction' option,
as TinyORM Schema builder currently only supports MySQL server, this option is
unused. */
namespace Migrations
{
struct CreatePostsTable : Migration
// struct _2014_10_12_000000_create_posts_table : Migration
{
/*! Filename of the migration file. */
T_MIGRATION
/*! The name of the database connection to use. */
// QString connection = QStringLiteral("tinyorm_tom");
/*! Wrapping the migration within a transaction, if supported. */
bool withinTransaction = false;
/*! Run the migrations. */
void up() const override
{
Schema::create("posts", [](Blueprint &table)
{
table.id();
table.string(NAME);
table.timestamps();
});
}
/*! Reverse the migrations. */
void down() const override
{
Schema::dropIfExists("posts");
}
};
} // namespace Migrations