NTP Analyzer  0.8.2
Analyze the operation of time servers
Change02.cs
Go to the documentation of this file.
1 //
2 // Copyright (c) 2013-2017 Carsten Sonne Larsen <cs@innolan.net>
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to deal
6 // in the Software without restriction, including without limitation the rights
7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 // copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 // THE SOFTWARE.
21 
22 using System.Collections;
23 using System.Collections.Generic;
24 using Ntp.Data.Schema;
25 
26 namespace Ntp.Analyzer.Data.Changes
27 {
28  public sealed class Change02 : IVersionChanges
29  {
30  public Change02()
31  {
32  changes = new List<SqlChangeSet>
33  {
34  // Adjust host name and IP length to RFC values
35  new SqlChangeSet(
36  "ALTER TABLE host " +
37  "MODIFY COLUMN name VARCHAR(255) NOT NULL;"
38  ),
39  new SqlChangeSet(
40  "ALTER TABLE host " +
41  "MODIFY COLUMN ip VARCHAR(45) NOT NULL;"
42  ),
43  new SqlChangeSet(
44  "ALTER TABLE peer " +
45  "MODIFY COLUMN name VARCHAR(255) NOT NULL;"
46  ),
47  new SqlChangeSet(
48  "ALTER TABLE peer " +
49  "MODIFY COLUMN ip VARCHAR(45) NOT NULL;"
50  ),
51  // Add time column to readings
52  new SqlChangeSet(
53  "ALTER TABLE hostIoReading " +
54  "ADD COLUMN zone INT NOT NULL DEFAULT 0;"
55  ),
56  new SqlChangeSet(
57  "ALTER TABLE hostReading " +
58  "ADD COLUMN zone INT NOT NULL DEFAULT 0;"
59  ),
60  new SqlChangeSet(
61  "ALTER TABLE peerReading " +
62  "ADD COLUMN zone INT NOT NULL DEFAULT 0;"
63  ),
64  new SqlChangeSet(
65  "ALTER TABLE peerActivity " +
66  "ADD COLUMN zone INT NOT NULL DEFAULT 0;"
67  )
68  };
69  }
70 
71  private readonly List<SqlChangeSet> changes;
72 
73  public string VersionText => "v0.7.2";
74 
75  public int VersionNumber => 000720;
76 
77  IEnumerator IEnumerable.GetEnumerator()
78  {
79  return changes.GetEnumerator();
80  }
81 
82  public IEnumerator<SqlChangeSet> GetEnumerator()
83  {
84  return changes.GetEnumerator();
85  }
86  }
87 }
IEnumerator< SqlChangeSet > GetEnumerator()
Definition: Change02.cs:82
readonly List< SqlChangeSet > changes
Definition: Change02.cs:71