Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9912 closed defect (fixed)

SimpleMultiProjectPlugin and MySQL not Working

Reported by: rauchenwald@… Owned by: falkb
Priority: high Component: SimpleMultiProjectPlugin
Severity: normal Keywords: MySQL, SimpleMultiProject
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

When trying:

trac-admin /path/to/env upgrade

the same "Error" occurs like in ticket http://trac-hacks.org/ticket/9729

SimpleMultiProject database schema version: 1 initialized.
SimpleMultiProject database schema is out of date: False
Database is up to date, no upgrade necessary.

Trying to add the required tables with the attached file (http://trac-hacks.org/attachment/ticket/9729/load_db.sql) fails cause MySQL uses other syntax.

When adding tables manually using:

CREATE TABLE `smp_project` (
	`id_project` INT(64) NOT NULL,
	`name` VARCHAR(512) NOT NULL,
	`description` VARCHAR(2048) NOT NULL DEFAULT '',
	PRIMARY KEY (`id_project`)
)
COLLATE='utf8_bin'
ENGINE=MyISAM;

CREATE TABLE `smp_milestone_project` (
	`id` INT(64) NOT NULL,
	`milestone` VARCHAR(512) NOT NULL,
	`id_project` INT(64) NOT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='utf8_bin'
ENGINE=MyISAM;

the option "projects" is visible in Admin section of trac, but when tryin to add the second project a error occurs, so using the following code via phpMyAdmin

ALTER TABLE `smp_project`
	CHANGE COLUMN `id_project` `id_project` INT(64) NOT NULL AUTO_INCREMENT FIRST;

now adding projects works fine BUT -> after logout the "admin" button is still visible to anonymous and shows the project settings.

also there is no option to add/choose project when clicking on admin->milestones->edit milestone

so after all there are some things not correct when using MySQL as Database...

btw: using Trac 0.12.3 under http://trac.rc-hosting.net

Attachments (0)

Change History (11)

comment:1 Changed 5 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 5 years ago by anonymous

thanks for the report problems found. You ask excuse for not correct yet, I hope to work soon on these improvements.

regards

comment:4 Changed 5 years ago by falkb

Currently, only sqlite is supported/tested. I haven't found a sufficiently good page explaining what exactly must be done for a port to MySQL. Anyway, most stuff is in model.py, patch for it is welcome.

comment:5 Changed 5 years ago by mig

In MySQL the length of VARCHAR is mandatory!

In Rev. 11731 the summary-field is missing. (The following patch fixes the issue for mysql).

  • simplemultiproject/environmentSetup.py

    a b  
    1616db_version = 4
    1717
    1818tables = [
    19     Table('smp_project', key = 'id') [
     19    Table('smp_project', key = 'id_project') [
    2020        Column('id_project', type = 'integer', auto_increment = True),
    21         Column('name',type = 'varchar'),
    22         Column('description',type='varchar')
     21        Column('name', type = 'varchar(255)'),
     22        Column('summary', type='varchar(255)'),
     23        Column('description', type='varchar(255)')
    2324    ],
    2425    Table('smp_milestone_project',key = 'id') [
    2526        Column('id', type = 'integer', auto_increment = True),
    26         Column('milestone',type = 'varchar'),
     27        Column('milestone', type = 'varchar(255)'),
    2728        Column('id_project',type = 'integer')
    2829    ],
    2930]
     
    3233    # Added with version 2
    3334    Table('smp_version_project',key = 'id') [
    3435        Column('id', type = 'integer', auto_increment = True),
    35         Column('version',type = 'varchar'),
     36        Column('version',type = 'varchar(255)'),
    3637        Column('id_project',type = 'integer')
    3738
    3839    ],

comment:6 Changed 5 years ago by anonymous

Micha, does this plugin work for you with MySQL now?

comment:7 Changed 5 years ago by falkb

Thanks for the patch, though I wonder if this is still compatible with the other supported database types, like SqLite (?). And as someone already asked, is this all to get the plugin running with MySQL? I can't test it but don't want to apply blindly.

comment:8 Changed 5 years ago by mig

Yes it works for me: @ mysql-5.1.62 . Trac 0.12

I haven't tested on other dbms.

Micha

comment:9 Changed 5 years ago by falkb

Owner: changed from Christopher Paredes to falkb
Status: newassigned

OK, then I'm going to test the patch with my SQLite system by trial'n'error.

comment:9 Changed 5 years ago by falkb

(In [11785]) Refs #9912: applied proposed patch of Micha Glave, but changed it a bit, because for compat reasons, table column 'summary' is added on upgrade from version 3 to 4. Please, test this commit and report if it still works with MySQL.

comment:10 Changed 5 years ago by mig

Resolution: fixed
Status: assignedclosed

works as expected with mysql!

trac > trac-admin . upgrade 
SimpleMultiProject database schema version: 4 initialized.
SimpleMultiProject database schema version: 0 installed.
SimpleMultiProject database schema is out of date: True
SimpleMultiProject database schema version: 4 initialized.
SimpleMultiProject database schema version: 0 installed.
SimpleMultiProject database schema is out of date: True
Upgrading SimpleMultiProject database schema
Upgrading SimpleMultiProject database schema
Upgrade done.

Micha

comment:11 Changed 5 years ago by falkb

Trac Release: 0.110.12

Cool, thank you!

Modify Ticket

Action
as closed The owner will remain falkb.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.