Commit graph

60 commits

Author SHA1 Message Date
Nurahmadie
aac0a8830f Merge branch 'mgt' into mt 2014-04-10 17:02:41 +00:00
Nurahmadie
1736716baa Migration tests for mysql
invoke:
    export DB_ENV=mysql
    export MYSQL_LOGIN='root:psswd@/'
    go test -v github.com/drone/drone/pkg/database/migrate/testing
2014-04-10 16:59:06 +00:00
Alex Suraci
10c3c8108e Revert "Revert "query and show commits by branch""
This reverts commit 7d52a4c4df.
2014-04-06 13:54:09 -07:00
Nurahmadie
202ea95368 Move testing related code 2014-04-06 15:04:38 +00:00
Nurahmadie
fe58917a7c Add stub for mysql test at migration 2014-04-06 15:04:37 +00:00
Nurahmadie
b9111a3f44 Add test for mysql 2014-04-06 15:04:36 +00:00
Brad Rydzewski
0c9a765956 Merge pull request #237 from fudanchii/gitlab
Gitlab integration support
2014-04-04 18:05:24 -07:00
Michael Nutt
efb5d4e0cf Merge remote-tracking branch 'drone/master' into fail-pending-on-startup
Conflicts:
	cmd/droned/drone.go
2014-04-01 15:32:43 -04:00
Michael Nutt
ce0a172136 combine sql statements to set both pending and started to failure on startup 2014-04-01 15:29:14 -04:00
Nurahmadie
c295776b87 Set gitlab_token column, and use ioutil for r.Body 2014-03-30 21:32:20 +00:00
Nurahmadie
15770e6237 Add gitlab options add admin page. 2014-03-29 11:51:02 +00:00
Nurahmadie
ea4917e278 Fix Bitbucket merging conflict 2014-03-29 06:49:44 +00:00
Nurahmadie
43c0a54718 Initial Gitlab Support 2014-03-29 06:37:50 +00:00
Nurahmadie
ded5c5ef7d sync mysql behavior with sqlite 2014-03-27 17:43:07 +07:00
Rafael Garcia
a284332a91 migrate/sqlite: create table only if it doesn't exist
fixes #224
2014-03-26 14:26:51 -07:00
Brad Rydzewski
fe1f2666f3 Merge pull request #171 from fudanchii/migration
[RFC] database refactorization
2014-03-25 12:45:30 -07:00
Michael Nutt
138beeeb45 also fail pending builds on startup 2014-03-24 00:21:33 -04:00
Michael Nutt
635b73a811 mark all previously started builds as failed on startup 2014-03-24 00:11:13 -04:00
Nurahmadie
7eb06fc0d5 Use NullString instead of checking for error. 2014-03-16 12:26:45 +07:00
Nurahmadie
44ffb70813 Use variadic parameters for DropColumns.
Also add some comments.
2014-03-16 12:26:18 +07:00
Nurahmadie
571f7d02b0 Fix some column type to work with both mysql and sqlite.
Basically this is caused by sqlite actually doesn't have any
column type restriction. also save gob type column as blob to enforce
byte-string value, since varchar with utf8 collation type will take at
least 3 byte to store, this will break YAML-Gob decoding at `params`
column.

Also fix some typo, and clean up fixtures code.
2014-03-15 18:20:11 +07:00
Nurahmadie
7cf4f2eb89 Preliminary MySQL support. Barely tested.
Requirements:
MySQL/MariaDB need to be configured with this settings:

  innodb_file_format = Barracuda
  innodb_file_per_table = On
  innodb_large_prefix = On

to support key prefix length up to 3042 bytes.

MySQL/MariaDB DSN will need this parameter:

  parseTime=true

as per [1]

The migration system itself mostly inspired by Rails (ActiveRecord),
but it still rough at the edges. Could use some inputs.

Next Todo: more testing!

[1]  https://github.com/go-sql-driver/mysql#parsetime
2014-03-14 02:28:10 +07:00
Nurahmadie
5903eb8f04 Add wrapper for common column types for easier column type
transformation between databases.
2014-03-13 18:53:52 +07:00
Brad Rydzewski
d70a6bb5f7 adding github testing 2014-03-11 23:00:06 -07:00
Nurahmadie
97825cf6bf Add usage info at migration script generator.
Also suppress error at the latest migration script
for backward compatibility with existing database, in which
open_invitations column wasn't added via migration.
2014-03-12 08:33:04 +07:00
Nurahmadie
89a00bd448 Refactor tests, add test for ChangeColumn method. 2014-03-12 07:04:34 +07:00
Nurahmadie
9a0b29d8b1 Remove database.Set, all setup being done in database.Init now. 2014-03-11 15:10:13 +07:00
Nurahmadie
92dfcbfca9 Move database schema to migration script. 2014-03-10 20:28:04 +07:00
Nurahmadie
76ed21c40f Cleanup some leftover
Don't have to import mattn/go-sqlite3 at pkg/database/migrate/sqlite.go
Remove unused DriverFunction declaration at migrate.go
2014-03-10 11:30:39 +07:00
Nurahmadie
d61bb3ef6c Fix index operation tests 2014-03-10 07:17:47 +07:00
Nurahmadie
489e38908a Implement ChangeColumn, AddIndex, and DropIndex methods for Operation interface. 2014-03-10 07:11:15 +07:00
Nurahmadie
81cf496811 Refactor migration.
Add `ChangeColumn`, `AddIndex`, `DropIndex` method to
Operation interface.
2014-03-10 07:08:58 +07:00
Nurahmadie
28fef9e3f4 Returns error if driver name is not listed.
Also remove references to postgresql driver for now.
And add some comments for `database.Init` method.
2014-03-08 18:12:43 +07:00
Nurahmadie
51519b62dd Actually use --driver option to set database driver for drone.
This includes refactoring database setup, and migration system.

Remove setupDatabase from main and use `Init` method from database
package.

At database package, defines Init method which actually initiate
database with options given from comand line flag. I think `--path`
wont be used anywhere so I plan to remove it later.

Both meddler and migration initiated here, then we call `Set` method
to setup all the tables, etc. Here I think I want to separate database
schema and turn it into migration script instead, later maybe.

At migration package I made some tweak to `Operation` interface.
Realized that it's ludicrous to let migration driver re-implement `Exec`
and `Query`, I made migration script to receive The whole
migrationDriver struct which contains both Operation implementor, and
the Tx itself. This made possible thanks to Go struct being able to
promote its member, now our migration is more transparent.

There's also stub implementation for bot mysql and postgresql, will
implement this really soon.
2014-03-08 12:19:28 +07:00
Brad Rydzewski
3c25a4a00a fixed issue updating team member roles 2014-02-21 13:26:50 -07:00
Nurahmadie
d9e4f3f509 Add shell script to generate migration script. 2014-02-19 08:15:51 +07:00
Nurahmadie
7b4c698e79 Refactor columns matching method 2014-02-19 07:38:53 +07:00
Nurahmadie
21f7fcb853 Fix index operations:
- Pass args as variadic params
- Tests for index operations
- Refactor fetchColumns
2014-02-19 01:11:41 +07:00
Nurahmadie
8d7cf16a89 Add func to fetch SQL definition for indices.
Also rearrange sql.Result and err declaration.
2014-02-18 21:22:22 +07:00
Nurahmadie
7a75c2d004 Keep indices when dropping/renaming columns. 2014-02-18 18:32:04 +07:00
Brad Rydzewski
2867818679 removed github domain and url from schema.go for unit tests 2014-02-17 23:10:20 -07:00
Brad Rydzewski
a200c7a0a2 altered migration to set default github domain and url 2014-02-17 23:08:06 -07:00
Brad Rydzewski
cb042e1c1a fixed compile error in migration script 2014-02-17 22:48:31 -07:00
Brad Rydzewski
bbb4bf48e0 Merge remote-tracking branch 'origin/master' 2014-02-17 22:42:01 -07:00
Brad Rydzewski
0e83e76ef4 removed unused migration sample file 2014-02-17 22:41:56 -07:00
Brad Rydzewski
85e60e4ee2 Merge pull request #75 from floatdrop/github-enterprise-support
GitHub Enterprise Support
2014-02-17 21:38:28 -08:00
Brad Rydzewski
7ce1e55ac3 Merge pull request #83 from fudanchii/migration
Migration system for sqlite
2014-02-17 20:46:13 -08:00
Vsevolod Strukchinsky
1505175288 Migration file based on #83
I choosed Rev3, because Rev2 will be about "open invitations" feature.
2014-02-16 11:57:16 +06:00
Vsevolod Strukchinsky
7208d95a76 Added GitHubApiUrl and GitHubDomain to settings and template 2014-02-16 11:45:14 +06:00
Brad Rydzewski
4b412d3a26 added code to prevent panic if /login is reached but no settings exist
minor styling. added success and fail message to top of /signup screen
modified open_registration to boolean value in database
2014-02-15 18:56:48 -07:00