Tag Archives: trac

trac0.12のテーブル構造

このエントリーをはてなブックマークに追加
はてなブックマーク - trac0.12のテーブル構造
Share on Facebook

カスタムレポートを作成しようとしてTrac DBのテーブル構造を探したのですが、意外とドキュメントが見つかりませんでした。 SQLite3の「.schema」コマンドの出力結果を載せておきます。

なお、このDBはTracLightning3.0.0で導入したTrac 0.12.ja1のものです。

trac.dbのスキーマ

CREATE TABLE attachment (
    type text,
    id text,
    filename text,
    size integer,
    time integer,
    description text,
    author text,
    ipnr text,
    UNIQUE (type,id,filename)
);
CREATE TABLE auth_cookie (
    cookie text,
    name text,
    ipnr text,
    time integer,
    UNIQUE (cookie,ipnr,name)
);
CREATE TABLE cache (
    id text PRIMARY KEY,
    generation integer
);
CREATE TABLE component (
    name text PRIMARY KEY,
    owner text,
    description text
);
CREATE TABLE enum (
    type text,
    name text,
    value text,
    UNIQUE (type,name)
);
CREATE TABLE forum (
    id integer PRIMARY KEY,
    name text,
    time integer,
    forum_group integer,
    author text,
    moderators text,
    subscribers text,
    subject text,
    description text
);
CREATE TABLE forum_group (
    id integer PRIMARY KEY,
    name text,
    description text
);
CREATE TABLE message (
    id integer PRIMARY KEY,
    forum integer,
    topic integer,
    replyto integer,
    time integer,
    author text,
    body text
);
CREATE TABLE milestone (
    name text PRIMARY KEY,
    due integer,
    completed integer,
    description text
);
CREATE TABLE node_change (
    repos integer,
    rev text,
    path text,
    node_type text,
    change_type text,
    base_path text,
    base_rev text,
    UNIQUE (repos,rev,path,change_type)
);
CREATE TABLE permission (
    username text,
    action text,
    UNIQUE (username,action)
);
CREATE TABLE report (
    id integer PRIMARY KEY,
    author text,
    title text,
    query text,
    description text
);
CREATE TABLE repository (
    id integer,
    name text,
    value text,
    UNIQUE (id,name)
);
CREATE TABLE revision (
    repos integer,
    rev text,
    time integer,
    author text,
    message text,
    UNIQUE (repos,rev)
);
CREATE TABLE session (
    sid text,
    authenticated integer,
    last_visit integer,
    UNIQUE (sid,authenticated)
);
CREATE TABLE session_attribute (
    sid text,
    authenticated integer,
    name text,
    value text,
    UNIQUE (sid,authenticated,name)
);
CREATE TABLE system (
    name text PRIMARY KEY,
    value text
);
CREATE TABLE ticket (
    id integer PRIMARY KEY,
    type text,
    time integer,
    changetime integer,
    component text,
    severity text,
    priority text,
    owner text,
    reporter text,
    cc text,
    version text,
    milestone text,
    status text,
    resolution text,
    summary text,
    description text,
    keywords text
);
CREATE TABLE ticket_change (
    ticket integer,
    time integer,
    author text,
    field text,
    oldvalue text,
    newvalue text,
    UNIQUE (ticket,time,field)
);
CREATE TABLE ticket_custom (
    ticket integer,
    name text,
    value text,
    UNIQUE (ticket,name)
);
CREATE TABLE topic (
    id integer PRIMARY KEY,
    forum integer,
    time integer,
    author text,
    subscribers text,
    subject text,
    body text
);
CREATE TABLE version (
    name text PRIMARY KEY,
    time integer,
    description text
);
CREATE TABLE wiki (
    name text,
    version integer,
    time integer,
    author text,
    ipnr text,
    text text,
    comment text,
    readonly integer,
    UNIQUE (name,version)
);
CREATE INDEX forum_time_idx ON forum (time);
CREATE INDEX message_time_idx ON message (time);
CREATE INDEX node_change_repos_rev_idx ON node_change (repos,rev);
CREATE INDEX revision_repos_time_idx ON revision (repos,time);
CREATE INDEX session_authenticated_idx ON session (authenticated);
CREATE INDEX session_last_visit_idx ON session (last_visit);
CREATE INDEX ticket_change_ticket_idx ON ticket_change (ticket);
CREATE INDEX ticket_change_time_idx ON ticket_change (time);
CREATE INDEX ticket_status_idx ON ticket (status);
CREATE INDEX ticket_time_idx ON ticket (time);
CREATE INDEX topic_time_idx ON topic (time);
CREATE INDEX wiki_time_idx ON wiki (time);

参考

TracLightning3.0とXAMPPを共存させる

このエントリーをはてなブックマークに追加
はてなブックマーク - TracLightning3.0とXAMPPを共存させる
Share on Facebook

ローカルホストには今までXAMPPとpukiwikiを入れていたのですが、リポジトリも一緒に扱えたら便利だと思ったので、ちまたで評判のTrac Lightningを導入してみました。

導入手順

1. ダウンロード

Trac Lightning Wiki – SourceForge.JPからダウンロードします。執筆時には3.0.0が最新版でした。

2. インストール

ダウンロードした TracLightning-3.0.0.exe を実行し、そのままインストールします。 私はJavaを使わないので、MavenとHudsonのチェックは外しました。

インストール後、再起動を求められるので再起動します。

3. httpd.confの設定

ここがXAMPPとの共存の肝です。TracLightingもApacheをインストールするので、ポートを変えてやらないとXAMPPとバッティングして起動できません。(両方とも標準でポート80を使う)

C:\TracLight\CollabNetSVN\httpd\conf\httpd.conf を開き、81番ポートを見るように変更します。

// 53行目
Listen 81

4. 起動

スタートメニューを開き、[Trac > コマンドプロンプトから実行]をクリックするとサービスが起動します。

ブラウザで http://localhost:81/trac/ にアクセスすると、無事プロジェクト一覧が表示されます。

以上で導入は完了です。プロジェクトの新規作成方法などは Trac の新規プロジェクト作成方法 – かおるんダイアリー (id:kaorun55) あたりを参考にしてください。

参考

tracのレポートでカラムの表示・非表示を切り替える

このエントリーをはてなブックマークに追加
はてなブックマーク - tracのレポートでカラムの表示・非表示を切り替える
Share on Facebook

業務上tracを使っています。

チケットを抽出するSQLをいじったとき、SELECTしたいカラムが画面に入らないことがよくありました。ヘルプを見てもよくわからなかったので、メモしておきます。

項目の表示・非表示を切替え方

  • SELECT句のASで指定する別名の先頭に「_ (アンダーバー)」をつけると、画面では非表示になります。
  • レポート最下部の「異なるフォーマットでダウンロード:」からRSSやCSVでダウンロードすると、中に含まれていることがわかります。

サンプル

SELECT
    p.value     AS __color__
  , version     AS __group__
  , id          AS ticket
  , summary     AS 概要
  , component   AS コンポーネント
  , milestone   AS マイルストーン
  , t.type      AS 分類
  , owner       AS 担当者
  , status      AS ステータス
  , time        AS 登録日付
  , changetime  AS 更新日付
  , description AS _説明        -- 画面には非表示
  , reporter    AS _報告者      -- 画面には非表示
FROM
    ticket t
    LEFT JOIN enum p 
    ON p.name = t.priority AND p.type = 'priority'
WHERE
    status <> 'closed'
    AND version = '2.0'
ORDER BY
    (version IS NULL)
  , version
  , CAST(p.value AS int)
  , t.type
  , time