Most of the data in the redmine system is stored in the database. To understand the overall structure of the redmine system, it is necessary to understand how the data is stored and what the table structure is, what is in it. Today, I will take a look at this content, mainly based on the content related to code review.
First, we will introduce several common MySQL operation commands:
Alter: Modify existing data tables (such as adding/deleting columns) and indexes. Create: Create a new database or data table. Delete: Delete table records. Drop: delete a data table or database. Index: Create or delete an index. Insert: Add Table records. Select: displays/searches for table records. Update: Modify existing records in the table.
These commands are relatively simple to use. You can view relevant information for specific usage.
Using the query command, we can find that redmine uses 51 tables after code review. The important items are as follows:
1. Projects
Mysql> select ID, Name Description, created_on, updated_on, Identifier from projects; + ---- + ---------------- + region + ------------ + | ID | description | created_on | updated_on | identifier | + ---- + ---------------- + region + ------------ + | 1 | Taobao project | 14:44:47 | 14:44:47 | Taobao | + ---- + ---------------- + ----------------------- + ------------ +
There are not many projects created, including the project name, Creation Time, And identifier.
2. changesets
mysql> select ID, repository_id, revision, committer, committed_on, comments, commit_date from changesets limit 4; + ---- + response + ---------- + ----------- + response + ----------- + | ID | repository_id | revision | committer | committed_on | comments | commit_date | + ---- + response + ---------- + ----------- + response --------------------- + ---------------------- + ----------- + | 1 | 1 | 1 | svncenter | 14:30:10 | add folder by system | 2011-08-10 | 2 | 1 | 2 | svncenter | 14:30:10 | add folder by System | 3 | 1 | 3 | svncenter | 14:30:11 | add folder by system | 4 | 1 | 4 | svncenter | 14:30:11 | add folder by system | | + ---- + --------------- + ---------- + ----------- + --------------------- + ---------------------- + ------------- +
SaveCodeRepository_id indicates the code base of the Project. Revision indicates the version number. A version number is added for each modification. committer indicates the modifier and committed_on indicates the modification time, comments is the comment of the modified content, and commit_date is the creation date.
3. Changes
mysql> select * from changes limit 4; + ---- + -------------- + -------- + upper + ----------- + upper + ---------- + -------- + | ID | changeset_id | action | path | from_path | from_revision | revision | branch | + ---- + -------------- + -------- + ----------------- + ----------- + --------------- + ---------- + -------- + | 1 | 1 | A |/trunk | null | 2 | A |/trunk/tmstable | null | 3 | 3 | A |/branches | null | 4 | 4 | A |/tags | null | null | + ---- + -------------- + -------- + ----------------- + ----------- + --------------- + ---------- + -------- +
Record each change in changesets in detail. changeset_id corresponds to the changed version in the previous changesets. Each version may correspond to multiple changes. Action is a change operation. There are three types. A represents a new file or folder, d Indicates deleting a file or folder. M indicates modifying a file or folder. Path indicates the path strength of the file. from_path indicates the path of the source file, which is valid only in M, from_revision and revision represent the versions before and after modification. Generally, they are null.
4. Repositories
Mysql> select ID, project_id, URL, type, path_encoding from repositories; + ---- + ------------ + upper + ------------ + ------------- + | ID | project_id | URL | type | path_encoding | + ---- + ------------ + upper + ------------ + --------------- + | 1 | http://svn.app.taobao.net/repos/tmstable | subversion | null | + ---- + ------------ + ------------------------------------------ + ------------ + --------------- +
The version library saves and edits the SVN version path.
the main code edited in redmine is saved in these databases. by querying these database tables, we can obtain the code table to be reviewed.