Conditions | 1 |
Paths | 1 |
Total Lines | 74 |
Code Lines | 57 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
20 | public function up(Schema $schema) : void |
||
21 | { |
||
22 | // this up() migration is auto-generated, please modify it to your needs |
||
23 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
24 | |||
25 | $this->addSql('CREATE TABLE parking_availabilities (id VARCHAR(22) NOT NULL, places INT NOT NULL, from_date DATE NOT NULL, to_date DATE NOT NULL, PRIMARY KEY(id))'); |
||
26 | $this->addSql('COMMENT ON COLUMN parking_availabilities.from_date IS \'(DC2Type:date_immutable)\''); |
||
27 | $this->addSql('COMMENT ON COLUMN parking_availabilities.to_date IS \'(DC2Type:date_immutable)\''); |
||
28 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
29 | |||
30 | $this->addSql('CREATE TABLE accounting_tasks (id VARCHAR(22) NOT NULL, type VARCHAR(50) NOT NULL, PRIMARY KEY(id))'); |
||
31 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
32 | |||
33 | $this->addSql('CREATE TABLE parking_member_needs (id VARCHAR(22) NOT NULL, member_id VARCHAR(22) DEFAULT NULL, date DATE NOT NULL, places INT NOT NULL, reason VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); |
||
34 | $this->addSql('CREATE INDEX idx_899a921e7597d3fe ON parking_member_needs (member_id)'); |
||
35 | $this->addSql('CREATE UNIQUE INDEX parking_member_needs_date_member_uidx ON parking_member_needs (date, member_id)'); |
||
36 | $this->addSql('COMMENT ON COLUMN parking_member_needs.date IS \'(DC2Type:date_immutable)\''); |
||
37 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
38 | |||
39 | $this->addSql('CREATE TABLE parking_availability_breaks (id VARCHAR(22) NOT NULL, places INT NOT NULL, reason VARCHAR(255) NOT NULL, date DATE NOT NULL, PRIMARY KEY(id))'); |
||
40 | $this->addSql('CREATE UNIQUE INDEX uniq_7adc18caa9e377a ON parking_availability_breaks (date)'); |
||
41 | $this->addSql('COMMENT ON COLUMN parking_availability_breaks.date IS \'(DC2Type:date_immutable)\''); |
||
42 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
43 | |||
44 | $this->addSql('CREATE TABLE access_users (id VARCHAR(22) NOT NULL, email VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); |
||
45 | $this->addSql('CREATE UNIQUE INDEX uniq_fd16d9bae7927c74 ON access_users (email)'); |
||
46 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
47 | |||
48 | $this->addSql('CREATE TABLE parking_reservations (id VARCHAR(22) NOT NULL, member_id VARCHAR(22) DEFAULT NULL, date DATE NOT NULL, type VARCHAR(50) NOT NULL, places INT NOT NULL, PRIMARY KEY(id))'); |
||
49 | $this->addSql('CREATE UNIQUE INDEX parking_reservations_date_member_uidx ON parking_reservations (date, member_id)'); |
||
50 | $this->addSql('CREATE INDEX idx_81af1b3a7597d3fe ON parking_reservations (member_id)'); |
||
51 | $this->addSql('COMMENT ON COLUMN parking_reservations.date IS \'(DC2Type:date_immutable)\''); |
||
52 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
53 | |||
54 | $this->addSql('CREATE TABLE access_slack_identities (id VARCHAR(22) NOT NULL, user_id VARCHAR(22) NOT NULL, slack_id VARCHAR(16) NOT NULL, email VARCHAR(255) NOT NULL, team_id VARCHAR(16) NOT NULL, name VARCHAR(255) NOT NULL, is_deleted BOOLEAN NOT NULL, color VARCHAR(6) NOT NULL, real_name VARCHAR(255) NOT NULL, tz VARCHAR(63) NOT NULL, tz_label VARCHAR(63) NOT NULL, tz_offset INT NOT NULL, is_admin BOOLEAN NOT NULL, is_bot BOOLEAN NOT NULL, updated INT NOT NULL, is_app_user BOOLEAN NOT NULL, PRIMARY KEY(id))'); |
||
55 | $this->addSql('CREATE UNIQUE INDEX uniq_5b43a04a76ed395 ON access_slack_identities (user_id)'); |
||
56 | $this->addSql('CREATE UNIQUE INDEX uniq_5b43a04e7927c74 ON access_slack_identities (email)'); |
||
57 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
58 | |||
59 | $this->addSql('CREATE TABLE parking_members (id VARCHAR(22) NOT NULL, user_id VARCHAR(22) DEFAULT NULL, name VARCHAR(255) NOT NULL, points INT NOT NULL, role VARCHAR(50) NOT NULL, PRIMARY KEY(id))'); |
||
60 | $this->addSql('CREATE UNIQUE INDEX uniq_cb4a2a25a76ed395 ON parking_members (user_id)'); |
||
61 | $this->addSql('CREATE UNIQUE INDEX uniq_cb4a2a255e237e06 ON parking_members (name)'); |
||
62 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
63 | |||
64 | $this->addSql('CREATE TABLE access_google_identities (id VARCHAR(22) NOT NULL, user_id VARCHAR(22) NOT NULL, google_id VARCHAR(25) NOT NULL, email VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, given_name VARCHAR(255) NOT NULL, family_name VARCHAR(255) NOT NULL, picture VARCHAR(255) NOT NULL, locale VARCHAR(5) NOT NULL, PRIMARY KEY(id))'); |
||
65 | $this->addSql('CREATE UNIQUE INDEX uniq_a12bac6e7927c74 ON access_google_identities (email)'); |
||
66 | $this->addSql('CREATE UNIQUE INDEX uniq_a12bac676f5c865 ON access_google_identities (google_id)'); |
||
67 | $this->addSql('CREATE UNIQUE INDEX uniq_a12bac6a76ed395 ON access_google_identities (user_id)'); |
||
68 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
69 | |||
70 | $this->addSql('CREATE TABLE accounting_journal_moves (id VARCHAR(22) NOT NULL, member_id VARCHAR(22) NOT NULL, journal_id VARCHAR(22) NOT NULL, given_points INT NOT NULL, received_points VARCHAR(255) NOT NULL, date DATE NOT NULL, PRIMARY KEY(id))'); |
||
71 | $this->addSql('CREATE INDEX idx_c68d82a478e8802 ON accounting_journal_moves (journal_id)'); |
||
72 | $this->addSql('CREATE INDEX idx_c68d82a7597d3fe ON accounting_journal_moves (member_id)'); |
||
73 | $this->addSql('COMMENT ON COLUMN accounting_journal_moves.date IS \'(DC2Type:date_immutable)\''); |
||
74 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
75 | |||
76 | $this->addSql('CREATE TABLE parking_memberships (id VARCHAR(22) NOT NULL, member_id VARCHAR(22) DEFAULT NULL, from_date DATE NOT NULL, to_date DATE NOT NULL, PRIMARY KEY(id))'); |
||
77 | $this->addSql('CREATE INDEX idx_daf589a27597d3fe ON parking_memberships (member_id)'); |
||
78 | $this->addSql('COMMENT ON COLUMN parking_memberships.from_date IS \'(DC2Type:date_immutable)\''); |
||
79 | $this->addSql('COMMENT ON COLUMN parking_memberships.to_date IS \'(DC2Type:date_immutable)\''); |
||
80 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
81 | |||
82 | $this->addSql('CREATE TABLE accounting_journals (id VARCHAR(22) NOT NULL, journal_id VARCHAR(22) NOT NULL, type VARCHAR(50) NOT NULL, PRIMARY KEY(id))'); |
||
83 | $this->addSql('CREATE INDEX idx_ab267833478e8802 ON accounting_journals (journal_id)'); |
||
84 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
85 | |||
86 | $this->addSql('CREATE TABLE system_request_log_details (id VARCHAR(22) NOT NULL, request_log_id VARCHAR(22) NOT NULL, path TEXT NOT NULL, meta TEXT NOT NULL, PRIMARY KEY(id))'); |
||
87 | $this->addSql('CREATE INDEX idx_4f124cf4a13e9e7d ON system_request_log_details (request_log_id)'); |
||
88 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
||
89 | |||
90 | $this->addSql('CREATE TABLE system_request_logs (id VARCHAR(22) NOT NULL, member_id VARCHAR(22) DEFAULT NULL, started_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, finished_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, type VARCHAR(50) NOT NULL, "group" VARCHAR(255) NOT NULL, mili_seconds INT NOT NULL, successfull BOOLEAN NOT NULL, PRIMARY KEY(id))'); |
||
91 | $this->addSql('CREATE INDEX idx_9c1bc9ab7597d3fe ON system_request_logs (member_id)'); |
||
92 | $this->addSql('COMMENT ON COLUMN system_request_logs.started_at IS \'(DC2Type:datetime_immutable)\''); |
||
93 | $this->addSql('COMMENT ON COLUMN system_request_logs.finished_at IS \'(DC2Type:datetime_immutable)\''); |
||
94 | } |
||
143 |