Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weather-model
Project
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
open-source
weather-model
Commits
0672e8d1
Commit
0672e8d1
authored
May 19, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change table_name of ShanghaiTen
parent
10471a07
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
1_create_city_forecasts.rb
db/migrate/1_create_city_forecasts.rb
+6
-6
source_schema.rb
lib/weather-model/source_schema.rb
+4
-4
No files found.
db/migrate/1_create_forecasts.rb
→
db/migrate/1_create_
city_
forecasts.rb
View file @
0672e8d1
class
CreateForecasts
<
ActiveRecord
::
Migration
[
5.0
]
class
Create
City
Forecasts
<
ActiveRecord
::
Migration
[
5.0
]
def
up
create_table
:forecasts
do
|
t
|
t
.
date
time
:datetim
e
create_table
:
city_
forecasts
do
|
t
|
t
.
date
:dat
e
t
.
integer
:temp_low
t
.
integer
:temp_high
t
.
string
:weather_text
...
...
@@ -14,11 +14,11 @@ class CreateForecasts < ActiveRecord::Migration[5.0]
end
# 两个index 一起查询会不会导致其中一个作用几乎消失
# 需不需要按城市来分表
add_index
:forecasts
,
:cityname
add_index
:forecasts
,
:datetime
add_index
:
city_
forecasts
,
:cityname
add_index
:
city_
forecasts
,
:datetime
end
def
down
drop_table
:forecasts
drop_table
:
city_
forecasts
end
end
lib/weather-model/source_schema.rb
View file @
0672e8d1
...
...
@@ -5,11 +5,11 @@ module WeatherModel
[
'Forecast'
]
end
ShanghaiTen
=
{
CityForecast
=
{
sort:
'Forecast'
,
table_name: :forecasts
,
table_name: :
city_
forecasts
,
schema:
{
date
time: :datetim
e
,
date
: :dat
e
,
cityname: :string
,
temp_high: :string
,
temp_low: :string
,
...
...
@@ -19,7 +19,7 @@ module WeatherModel
win_speed: :string
,
},
options:
{
index:
[
:cityname
],
index:
[
:cityname
,
:date
],
expire:
1
,
unique: :mysql_id
,
father:
nil
,
...
...
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