Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test-project
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Junaid Rahman pv
test-project
Commits
fed7b063
Commit
fed7b063
authored
Aug 31, 2016
by
Junaid Rahman pv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created migrations for business and location(state,district)
parent
61e93916
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
0 deletions
+111
-0
m160831_080848_location.php
common/migrations/db/m160831_080848_location.php
+49
-0
m160831_092919_business.php
common/migrations/db/m160831_092919_business.php
+62
-0
No files found.
common/migrations/db/m160831_080848_location.php
0 → 100644
View file @
fed7b063
<?php
use
yii\db\Migration
;
class
m160831_080848_location
extends
Migration
{
public
function
safeUp
()
{
$tableOptions
=
null
;
if
(
$this
->
db
->
driverName
===
'mysql'
)
{
$tableOptions
=
'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'
;
}
$this
->
createTable
(
'{{%state}}'
,
[
'id'
=>
$this
->
primaryKey
(),
'name'
=>
$this
->
string
(
1024
)
->
notNull
(),
'slug'
=>
$this
->
string
(
1024
),
'status'
=>
$this
->
smallInteger
(
6
),
'created_at'
=>
$this
->
integer
(
11
),
'updated_at'
=>
$this
->
integer
(
11
),
],
$tableOptions
);
$this
->
createTable
(
'{{%district}}'
,
[
'id'
=>
$this
->
primaryKey
(),
'state_id'
=>
$this
->
integer
()
->
notNull
(),
'name'
=>
$this
->
string
(
1024
)
->
notNull
(),
'slug'
=>
$this
->
string
(
1024
),
'status'
=>
$this
->
smallInteger
(
6
),
'created_at'
=>
$this
->
integer
(
11
),
'updated_at'
=>
$this
->
integer
(
11
),
],
$tableOptions
);
$this
->
createIndex
(
'idx_state_name'
,
'{{%state}}'
,
'name'
);
$this
->
createIndex
(
'idx_state_id'
,
'{{%district}}'
,
'state_id'
);
$this
->
createIndex
(
'idx_district_name'
,
'{{%district}}'
,
'name'
);
$this
->
addForeignKey
(
'fk_state_id'
,
'{{%district}}'
,
'state_id'
,
'{{%state}}'
,
'id'
,
'RESTRICT'
,
'RESTRICT'
);
}
public
function
safeDown
()
{
$this
->
dropForeignKey
(
'fk_state_id'
,
'{{%district}}'
);
$this
->
dropTable
(
'{{%district}}'
);
$this
->
dropTable
(
'{{%state}}'
);
}
}
common/migrations/db/m160831_092919_business.php
0 → 100644
View file @
fed7b063
<?php
use
yii\db\Migration
;
class
m160831_092919_business
extends
Migration
{
public
function
safeUp
()
{
$tableOptions
=
null
;
if
(
$this
->
db
->
driverName
===
'mysql'
)
{
$tableOptions
=
'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'
;
}
$this
->
createTable
(
'{{%business}}'
,
[
'id'
=>
$this
->
primaryKey
(),
'category_id'
=>
$this
->
integer
()
->
notNull
(),
'district_id'
=>
$this
->
integer
()
->
notNull
(),
'domain_name'
=>
$this
->
string
(
255
)
->
notNull
(),
'name'
=>
$this
->
string
(
512
),
'slug'
=>
$this
->
string
(
1024
),
'address'
=>
$this
->
string
(
1024
),
'landmark'
=>
$this
->
string
(
500
),
'mobile_no'
=>
$this
->
string
(
512
),
'toll_free_no'
=>
$this
->
string
(
512
),
'contact_no'
=>
$this
->
string
(
150
),
'fax'
=>
$this
->
string
(
512
),
'email'
=>
$this
->
string
(
1024
),
'website'
=>
$this
->
string
(
1024
),
'description'
=>
$this
->
text
(),
'logo_base_url'
=>
$this
->
string
(
1024
),
'logo_path'
=>
$this
->
string
(
1024
),
'latitude'
=>
$this
->
string
(
30
),
'logitude'
=>
$this
->
string
(
30
),
'status'
=>
$this
->
smallInteger
(
6
),
'created_at'
=>
$this
->
integer
(
11
),
'updated_at'
=>
$this
->
integer
(
11
),
],
$tableOptions
);
$this
->
createIndex
(
'idx-business-category_id'
,
'{{%business}}'
,
'category_id'
);
$this
->
createIndex
(
'idx-business-district_id'
,
'{{%business}}'
,
'district_id'
);
$this
->
createIndex
(
'idx-business-domain_name'
,
'{{%business}}'
,
'domain_name'
);
$this
->
createIndex
(
'idx-business-email'
,
'{{%business}}'
,
'email'
);
$this
->
addForeignKey
(
'fk_category_id'
,
'{{%business}}'
,
'category_id'
,
'{{%category}}'
,
'id'
,
'RESTRICT'
,
'RESTRICT'
);
$this
->
addForeignKey
(
'fk_district_id'
,
'{{%business}}'
,
'district_id'
,
'{{%district}}'
,
'id'
,
'RESTRICT'
,
'RESTRICT'
);
}
public
function
safeDown
()
{
$this
->
dropForeignKey
(
'fk_district_id'
,
'{{%business}}'
);
$this
->
dropForeignKey
(
'fk_category_id'
,
'{{%business}}'
);
$this
->
dropIndex
(
'idx-business-email'
,
'{{%business}}'
);
$this
->
dropIndex
(
'idx-business-domain_name'
,
'{{%business}}'
);
$this
->
dropIndex
(
'idx-business-district_id'
,
'{{%business}}'
);
$this
->
dropIndex
(
'idx-business-category_id'
,
'{{%business}}'
);
$this
->
dropTable
(
'{{%business}}'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment