Redmineã®ãã©ã°ã¤ã³ä½æã®ããã®åå¿é²ã¨ãæã SQLite3
ãããã
- ä»ããã¨å¹¸ãã«ãªãããã®
- ãã±ããã®CSVã¨ã¯ã¹ãã¼ãæ©è½ããã ããå±¥æ´ã¤ãã§ããããããã¨ãããããã°ã¨ãPJ課é¡ã®ç®¡çãRedmineã§ä¸å åã§ãExcelã®åªç¸ãã解ãæ¾ã¦ãããâ¦â¦
æ¢ã«å±¥æ´ã¤ãCSVã¨ã¯ã¹ãã¼ããã©ã°ã¤ã³ã¯åå¨ãã¦ããããã§ãã履歴付チケット一覧出力プラグインを書いてみた - すえひろがりっっっっ!ããã ãå±¥æ´ã®åºæ¹ã1å±¥æ´æ¯ã«åãæ´æ°ãªãã§ããããã
No, ... ,å±¥æ´ 1, ... ,#1ã®å±¥æ´,#2ã®å±¥æ´,#3ã®å±¥æ´ 2, ... ,#1ã®å±¥æ´,#2ã®å±¥æ´
ä»èªåãæ±ãã¦ããç¸ãçã«ã¯ããåºã¦ã»ããã
No, ... ,å±¥æ´ 1, ... ,"#1ã®å±¥æ´ #2ã®å±¥æ´, #3ã®å±¥æ´" 2, ... ,"#1ã®å±¥æ´, #2ã®å±¥æ´"
åãåºããã¨ãã«ãã±ãã1ã¤ã®å±¥æ´ã1ã»ã«ã®ä¸ã«åããããCSVã«æ¹è¡ã¯ã©ããªãã ã¨ã1ã»ã«ã«æ¹è¡ãã¾ããã®ã¯ã©ããªãã ã¨ãè²ã ããã¾ããããã¯ç¸ããªã®ã§ããã
ã ããã§ããããæ©ä¼ã«Redmineã®ãã©ã°ã¤ã³ã¯ã©ãä½ãã®ãã調ã¹ã¦ã¿ã¾ããã
åèãµã¤ã
ãã©ã°ã¤ã³ã®ã¹ã±ã«ãã³ä½æ
ã¾ãã¯ãã©ã°ã¤ã³ã®ã¹ã±ã«ãã³ã¨ãããã®ãä½æããããã³ãã¬ã¼ãã¿ãããªãã®ï¼ã以ä¸ã®ã³ãã³ãã§èªåçæãã¦ããã¾ãã*2
>ruby script\generate redmine_plugin extendCsv
ããã¨ãããªãã¨ã©ã¼ã
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
ããã«ã
LIBMYSQL.dll ãè¦ã¤ãããªãã£ãããããã®ã¢ããªã±ã¼ã·ã§ã³ãéå§ã§ãã¾ããã§ãããâ¦
libmysqlãå¿ è¦ãããããªãã§mysqlãªãã ããï¼ãSQLite3使ãããã«ãã¦ãªãã£ãã£ãï¼
(ç¥)
ãã¼ããã£ããconfig/database.ymlããããªã£ã¦ããã
production: adapter: sqlite3 database: db/redmine development: adapter: mysql database: redmine_development host: localhost username: root password: encoding: utf8
productionã¯å¤ãã¦ãããã©developmentã¯ããã©ã«ã=MySQLã®ã¾ã¾ã ã£ããéçºæã¯developmentã¢ã¼ãã使ãããã«ãªã£ã¦ããããmysqlæ¢ãåºããã®ããå¤ãã¦ã¿ãã
production: adapter: sqlite3 database: db/redmine development: adapter: sqlite3 database: db/redminedev
å度ã
>ruby script\generate redmine_plugin extendCsv
C:\redmine-1.0.0>ruby script\generate redmine_plugin extendCsv create vendor/plugins/redmine_extend_csv/app/controllers create vendor/plugins/redmine_extend_csv/app/helpers create vendor/plugins/redmine_extend_csv/app/models create vendor/plugins/redmine_extend_csv/app/views create vendor/plugins/redmine_extend_csv/db/migrate create vendor/plugins/redmine_extend_csv/lib/tasks create vendor/plugins/redmine_extend_csv/assets/images create vendor/plugins/redmine_extend_csv/assets/javascripts create vendor/plugins/redmine_extend_csv/assets/stylesheets create vendor/plugins/redmine_extend_csv/lang create vendor/plugins/redmine_extend_csv/config/locales create vendor/plugins/redmine_extend_csv/test create vendor/plugins/redmine_extend_csv/README.rdoc create vendor/plugins/redmine_extend_csv/init.rb create vendor/plugins/redmine_extend_csv/lang/en.yml create vendor/plugins/redmine_extend_csv/config/locales/en.yml create vendor/plugins/redmine_extend_csv/test/test_helper.rb
vendor/pluginsä¸ã«ã¹ã±ã«ãã³ãã§ããããã®ãvendor/plugins/ä»åä½æãããã£ã¬ã¯ããªãã¨ããã®ããã©ã°ã¤ã³ã®ã«ã¼ãã«ãªãããã§ãã
C:\redmine-1.0.0\vendor\plugins>dir 2011/09/06 09:24 <DIR> . 2011/09/06 09:24 <DIR> .. ç¥ 2011/09/06 09:24 <DIR> redmine_extend_csv ç¥
ãã©ã¹ãèªåã§é ã«ãredmineãä»å +ã¹ãã¼ã¯ã±ã¼ã¹ã«ãªãã¼ã ãã¦ããã¦ããããããè¦ç´ãâ¦ï¼ãã¨ãããããã©ã«ãæ§æçã¯ç½®ãã¦ããã¦ã次ã®ç« ã¸ã
init.rbã®ä½æ
ãã©ã°ã¤ã³åãä½è åãªã©ãè¨è¿°ã§ãããä»ã¯ç¹ã«ãªã«ãè¨å®ãããå¾ã§ãã©ã°ã¤ã³ã表示ããæã«æ»ã£ã¦æ¥ã¾ãã
ããã§ä¸åèµ·åãã¦ã¿ãã
>ruby script\server
ãªãã·ã§ã³ã«-e productionãã¤ããªãã¨developmentã¢ã¼ãã§èµ·åããããã®åã«ãDBã®åæåããã¦ããªãå ´åã¯åæåãâ¦â¦ã(RAILS_ENV=productionãé¤å¤)
>rake db:migrate >rake redmine:load_default_data
ããã¦Redmineèµ·å -> 管ç -> ãã©ã°ã¤ã³ãè¦ã«è¡ãã¨â¦ãã£ãï¼(åçãªã)
è£è¶³:SQLite3ãããã
ã¡ãã£ã¨SQLite3ã使ã£ã¦ã¿ããã³ã³ã½ã¼ã«ããè¦ããã¨ããªãã ããã¨exeã¯DLãã¦ããªãã£ãã®ã§ä»ååã
- ã¾ãexeçSQLite3ãDL
- å®è¡
# Redmineã®config/database.ymlã§å®ç¾©ãä½æããDBã¸æ¥ç¶ >sqlite3.exe REDMINE_DB_FILE SQLite version 3.7.7.1 2011-06-28 17:39:05 Enter ".help" for instructions Enter SQL statements terminated with a ";"
ä»åã¯ã¨ããããä¸è¨ã®2ã¤ã®ã³ãã³ããè¦ãã¦å¸°ãã
.table | ãã¼ãã«ä¸è¦§ãåå¾ãã |
---|---|
pragma_table_info(TABLE) | ãã¼ãã«ã®ã«ã©ã æ å ±ãåå¾ãã |
- .table
sqlite> .table attachments news auth_sources open_id_authentication_associations boards open_id_authentication_nonces changes projects changesets projects_trackers changesets_issues queries comments repositories custom_fields roles custom_fields_projects schema_migrations custom_fields_trackers settings custom_values time_entries documents tokens enabled_modules trackers enumerations user_preferences groups_users users issue_categories versions issue_relations watchers issue_statuses wiki_content_versions issues wiki_contents journal_details wiki_pages journals wiki_redirects member_roles wikis members workflows
- pragma_table_info(TABLE)
sqlite> pragma table_info(issues); 0|id|INTEGER|1||1 1|tracker_id|integer|1|0|0 2|project_id|integer|1|0|0 3|subject|varchar(255)|1|''|0 4|description|text|0||0 5|due_date|date|0||0 6|category_id|integer|0||0 7|status_id|integer|1|0|0 8|assigned_to_id|integer|0||0 9|priority_id|integer|1|0|0 10|fixed_version_id|integer|0||0 11|author_id|integer|1|0|0 12|lock_version|integer|1|0|0 13|created_on|datetime|0||0 14|updated_on|datetime|0||0 15|start_date|date|0||0 16|done_ratio|integer|1|0|0 17|estimated_hours|float|0||0 18|parent_id|integer|0|NULL|0 19|root_id|integer|0|NULL|0 20|lft|integer|0|NULL|0 21|rgt|integer|0|NULL|0
ä»å欲ãããã¼ãã«ã¯issues, journals, journal_detailsã®3ã¤ã§OKã®ã¯ããªã®ã§*3ãããã¡ãã£ã¨ã¡ã¢ãã¦ããã
sqlite> pragma table_info(issues); 0|id |INTEGER |1| |1 1|tracker_id |integer |1|0 |0 2|project_id |integer |1|0 |0 3|subject |varchar(255)|1|'' |0 4|description |text |0| |0 5|due_date |date |0| |0 6|category_id |integer |0| |0 7|status_id |integer |1|0 |0 8|assigned_to_id |integer |0| |0 9|priority_id |integer |1|0 |0 10|fixed_version_id|integer |0| |0 11|author_id |integer |1|0 |0 12|lock_version |integer |1|0 |0 13|created_on |datetime |0| |0 14|updated_on |datetime |0| |0 15|start_date |date |0| |0 16|done_ratio |integer |1|0 |0 17|estimated_hours |float |0| |0 18|parent_id |integer |0|NULL|0 19|root_id |integer |0|NULL|0 20|lft |integer |0|NULL|0 21|rgt |integer |0|NULL|0 sqlite> pragma table_info(journals); 0|id |INTEGER |1| |1 1|journalized_id |integer |1|0 |0 2|journalized_type|varchar(30) |1|'' |0 3|user_id |integer |1|0 |0 4|notes |text |0| |0 5|created_on |datetime |1| |0 sqlite> pragma table_info(journal_details); 0|id |INTEGER |1| |1 1|journal_id |integer |1|0 |0 2|property |varchar(30) |1|'' |0 3|prop_key |varchar(30) |1|'' |0 4|old_value |varchar(255)|0| |0 5|value |varchar(255)|0| |0
ããã§æºåã¨ãã¼ã¿ãè¦ããã¨ã¯ã§ããããã«ãªã£ãï¼ã次ããã¯å®éã«ãã©ã°ã¤ã³ã®ä¸èº«ã«å ¥ã£ã¦ããï¼
*1:[http://redmine.jp/guide/RedmineInstall/:title]ãã«æºæ ã
*2:éä¸ã§ã³ãã³ãããã³ããããConsole2ã¨ããããªã¼ã½ããã«åãæ¿ããã®ã§ãã¹ã®åºåãã\ã ã£ãã/ã ã£ãããã¦ã¾ãã
*3:ãã±ããã®å±¥æ´ãjournalãã¼ãã«ã§ç®¡çããã¦ããã®ãæ¢ãã®ã«æéåã£ããã ãã©ãã©ãæ¢ãã®ãã¯ã¼ã«ãªãã ããããã±ããç»é¢é·ç§»ããã¨ãã®ãã°ã§æ¢ãã¦è¾¿ãçãããã ãã©ã